#pragma once

#include "commonheader.h"
#include "TCPSocket.h"

class CHttpTurnnel
{
public:
	CHttpTurnnel(SOCKET sSock);
	~CHttpTurnnel();

	BOOL InitTurnnel();
private:
#define SOCKETARRAYSIZE 2
	int mNum;
	CTCPSocket *mSide1Socket;
	CTCPSocket *mSide2Socket;

	typedef enum {
		eTurnnelIniting = 0,
		eTurnnelInited
	}TunnelStateT;
	TunnelStateT mStage;

	int ConnectServer(char*buf, long buflen);
	static int Side1MsgHandle(char*buf, long buflen, LPVOID argv);
	static int Side2MsgHandle(char*buf, long buflen, LPVOID argv);
};

